# -*- coding: utf-8 -*-
"""
分布式——服务端
"""

from multiprocessing import Process
from multiprocessing.managers import BaseManager
import queue
import uuid


class ServerManager(BaseManager):
    pass


master_queue = queue.Queue()
worker_queue = queue.Queue()
ServerManager.register('get_master_queue', callable=lambda: master_queue)
ServerManager.register('get_worker_queue', callable=lambda: worker_queue)


def master_server():
    server_manager = ServerManager(address=('0.0.0.0', 5000), authkey=b'chench')

    server = server_manager.get_server()
    server.serve_forever()

    # server_manager.start()
    # server_manager.shutdown()

    pass


if __name__ == '__main__':
    server = Process(target=master_server)
    server.start()

    pass
